#ifndef FUNCTION_H
#define FUNCTION_H

#include <functional>

#include "Value.h"
#include "Property.h"
#include "Object.h"
#include "Array.h"

#include <boost/function.hpp>
#include <boost/bind.hpp>

class Function
{
public:
	Function(); //: args(new ValueArray()), func(0) {}
	Function(const Function& f);
	
	virtual ~Function();


//	::Value& 				call();
	::Value 				call();

//	::Value 				operator()() const								{ return func(*args); }
	::Value 				operator()() 									{ return call(); }
	bool const 				operator==(const Function& f)					{ return (this==&f); }
	friend std::ostream& 	operator<<(std::ostream& stream, Function f)	{ return stream << "Function"; }
	
	Function&				operator=(const Function& f)
	{
			args = f.args;
			func = f.func;
	}
	
	ValueArray* args;
//	boost::function< ::Value(::Value*, int) > func;
	boost::function< ::Value(ValueArray*) > func;	
};

#endif // FUNCTION_H
